import request from '@/utils/request'

// 请求初始化数据
// mode: buyNow, cart
export const getPayData = (mode, obj) => {
  return request({
    url: '/checkout/order',
    method: 'get',
    params: {
      mode,
      delivery: 10,
      shopId: 0,
      couponId: 0,
      isUsePoints: 0,
      ...obj
    }
  })
}

// 提交订单
export const submitOrder = (mode, obj) => {
  return request({
    url: '/checkout/submit',
    method: 'post',
    data: {
      delivery: 10,
      couponId: 0,
      isUsePoints: 0,
      payType: 10,
      mode,
      ...obj
    }
  })
}

// my order
export const getOrderList = (dataType) => {
  return request({
    url: '/order/list',
    params: {
      dataType,
      page: 1
    }
  })
}
